<?php if (!defined('THINK_PATH')) exit();?> <!DOCTYPE html>
<html>
  
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>
      <?php echo $title; ?> - <?php echo C('TITLE'); ?>
    </title>
     <link rel="stylesheet" href="//at.alicdn.com/t/font_mqhl04idhqx8byb9.css">
      <link rel="stylesheet" href="/project/fly/Public/layui/css/layui.css">
      <link rel="stylesheet" href="/project/fly/Public/css/global.css">
       <script src="/project/fly/Public/layui/layui.js">
        </script>
    <script src="/project/fly/Public/js/jquery-3.2.1.min.js">
        </script>
  </head>
  
  <body>
    <div class="header">
      <div class="main">
        <a class="logo" href="<?php echo U('home/index/index');?>" title="Fly">
          仿Fly社区
        </a>
        <div class="nav">
          <a href="<?php echo U('Home/index/all');?>" class="<?php if(in_array(ACTION_NAME, ['all','unsolve','solve','wonder','myquestion']))echo 'nav-this' ?>">
            <i class="iconfont icon-wenda">
            </i>
            讨论
          </a>
          <a href="javascript:;">
            <i class="iconfont icon-iconmingxinganli" style="top: 2px;">
            </i>
            案例
          </a>
          <a href="javascript:;">
            <i class="iconfont icon-ui">
            </i>
            框架
          </a>
        </div>
          <?php if($_SESSION['uid']){ ?>
           <div class="nav-user">
	         <a class="avatar" href="<?php echo U('Home/userCenter/set');?>">
	           <img src='/project/fly/<?php echo $_SESSION['face'] ?>'>
	           <cite>
	             <?php echo $_SESSION['nickname'] ?>
	           </cite>
	         </a>
           <?php if($_SESSION['msg']!=0 && $_SESSION['msg']<=99){ ?>
              <a class="nav-message" href="<?php echo U('home/userCenter/delMsg',['del'=>1]);?>" title="您有<?php echo $_SESSION['msg']; ?>条未阅读的消息"><?php echo $_SESSION['msg']; ?></a>
            <?php }elseif($_SESSION['msg']>99){ ?>
              <a class="nav-message" href="<?php echo U('home/userCenter/delMsg',['del'=>1]);?>" title="您有99+条未阅读的消息"><?php echo '99+'; ?></a>
            <?php } ?>
	         <div class="nav">
	           <a href="<?php echo U('home/userCenter/set');?>">
	             <i class="iconfont icon-shezhi">
	             </i>
	             设置
	           </a>
	           <a href="<?php echo U('home/logOut/index');?>">
	             <i class="iconfont icon-tuichu" style="top: 0; font-size: 22px;">
	             </i>
	             退了
	           </a>
	         </div>
		     </div>
          	<?php }else{ ?>
				<div class="nav-user">
		          <a class="unlogin" href="/user/login/">
		            <i class="iconfont icon-touxiang">
		            </i>
		          </a>
		          <span>
		            <a href="<?php echo U('home/login/index');?>">
		              登入
		            </a>
		            <a href="<?php echo U('home/reg/index');?>">
		              注册
		            </a>
		          </span>
		          <p class="out-login">
		            <a href="http://fly.layui.com/app/qq" onclick="layer.msg('正在通过QQ登入', {icon:16, shade: 0.1, time:0})"
		            class="iconfont icon-qq" title="QQ登入">
		            </a>
		            <a href="http://fly.layui.com/app/weibo/" onclick="layer.msg('正在通过微博登入', {icon:16, shade: 0.1, time:0})"
		            class="iconfont icon-weibo" title="微博登入">
		            </a>
		          </p>
          </div>
          	<?php } ?>
         
      </div>
    </div>



<style type="text/css">
  .search{
    width: 250px;
    height: 50px;
    position: absolute;
    right: 5px;
    z-index: 100;
  }
  .search button{
    position: relative;
    right: -80px;
    top:-32px;
  }
  .search-txt{
    position: relative;
    top:6px;
    right: 70px;
    z-index: 10000;
    width: 150px;
  }
  .sub{
    width: 30px;
    font-size: 20px;
    line-height: 40px;
    height: 30px;
  }
</style>
    <div class="main layui-clear">
      <div class="wrap">
        <div class="content">
          <div class="fly-tab">
            <div class="layui-tab layui-tab-brief">
               <div class="search">
                  <form action="<?php echo U('home/search/index');?>" class="layui-form" method="get">
                    <div class="layui-input-block">
                      <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入内容" class="layui-input search-txt">
                       <button class="layui-btn" type="submit">搜索</button>
                    </div><!-- 
                    <input class='search-txt' type="text"> -->
                   
                    <!-- <input class='sub layui-btn layui-btn-normal' type="submit" value="&#xe615;"> -->
                  </form>
                </div>
              <ul class="layui-tab-title">
                <li class="<?php if(ACTION_NAME=='index'){echo 'layui-this';} ?>">
                  <a href="<?php echo U('Home/index/index');?>">
                    首页
                  </a>
                </li>
                <li class="<?php if(ACTION_NAME=='all'){echo 'layui-this';} ?>">
                  <a href="<?php echo U('Home/index/all');?>">
                    全部帖
                  </a>
                </li>
                <li class="<?php if(ACTION_NAME=='unsolve'){echo 'layui-this';} ?>">
                  <a href="<?php echo U('Home/index/unsolve');?>">
                    未结帖
                  </a>
                </li>
                <li class="<?php if(ACTION_NAME=='solve'){echo 'layui-this';} ?>">
                  <a href="<?php echo U('Home/index/solve');?>">
                    已采纳
                  </a>
                </li>
                <li class="<?php if(ACTION_NAME=='wonder'){echo 'layui-this';} ?>">
                  <a href="<?php echo U('Home/index/wonder');?>">
                    精华帖
                  </a>
                </li>
                <?php if(isset($_SESSION['uid'])): ?>
                  <li class="<?php if(ACTION_NAME=='myquestion'){echo 'layui-this';} ?>">
                    <a href="<?php echo U('Home/index/myquestion');?>">
                      我的帖
                    </a>
                  </li>
                <?php endif; ?>
               
              </ul>
              
            </div>
           
          </div>
          <ul class="fly-panel fly-list fly-list-top">
            <?php foreach ($top as $v) : ?>
              <li class="fly-list-li">
                <a href="<?php echo U('home/userCenter/center',array('id'=>$v['uid']));?>" class="fly-list-avatar">
                  <img src="<?php echo '/project/fly/'.$v['face'] ?>" alt="<?php echo $v['nickname']; ?>">
                </a>
                <h2 class="fly-tip">
                  <a href="<?php echo U('home/discuss/index',array('qid'=>$v['qid']));?>">
                    <?php echo $v['title']; ?>
                  </a>
                  <span class="fly-tip-stick">
                    置顶
                  </span>
                </h2>
                <p>
                  <span>
                    <a href="<?php echo U('home/userCenter/center',array('id'=>$v['uid']));?>">
                      <?php echo $v['nickname']; ?>
                    </a>
                  </span>
                  <span>
                    <?php echo Ctime($v['create_time']); ?>
                  </span>
                  <span>
                    <?php echo $v['cname']; ?>
                  </span>
                  <span class="fly-list-hint">
                    <i class="iconfont" title="回答">
                      &#xe60c;
                    </i>
                    <?php echo $v['answer_num']; ?>
                    <i class="iconfont" title="人气">
                      &#xe60b;
                    </i>
                    <?php echo $v['view_num']; ?>
                  </span>
                </p>
              </li>
            <?php endforeach; ?>
          </ul>
          
          <ul class="fly-panel fly-list">
            <?php foreach ($main as $v) : ?>
              <li class="fly-list-li">
                <a href="<?php echo U('home/userCenter/center',array('id'=>$v['uid']));?>" class="fly-list-avatar">
                  <img src="<?php echo '/project/fly/'.$v['face'] ?>" alt="<?php echo $v['nickname']; ?>">
                </a>
                <h2 class="fly-tip">
                  <a href="<?php echo U('home/discuss/index',array('qid'=>$v['qid']));?>">
                    <?php echo $v['title']; ?>
                  </a>
                  <?php if($v['level']==1): ?>
                     <span class="fly-tip-jing">
                        精华
                      </span>
                  <?php endif; ?>
                </h2>
                <p>
                  <span>
                    <a href="<?php echo U('home/userCenter/center',array('id'=>$v['uid']));?>">
                      <?php echo $v['nickname']; ?>
                    </a>
                  </span>
                  <span>
                    <?php echo Ctime($v['create_time']); ?>
                  </span>
                  <span>
                    <?php echo $v['cname']; ?>
                  </span>
                  <span class="fly-list-hint">
                    <i class="iconfont" title="回答">
                      &#xe60c;
                    </i>
                    <?php echo $v['answer_num']; ?>
                    <i class="iconfont" title="人气">
                      &#xe60b;
                    </i>
                    <?php echo $v['view_num']; ?>
                  </span>
                </p>
              </li>
            <?php endforeach; ?>
          </ul>
          <div style="text-align: center">
            <div class="laypage-main">
              <a href="<?php echo U('home/index/all',array('p'=>2));?>" class="laypage-next">
                更多求解
              </a>
            </div>
          </div>
        </div>
      </div>
      <div class="edge">
        <div class="jie-add">
          <a href="<?php echo U('home/publish/index');?>" class="layui-btn layui-btn-big">
            发表新帖
          </a>
          <a href="javascript:layer.msg('尚未开放');" class="layui-btn layui-btn-big layui-btn-normal"
          style="margin-left: 10px;">
            共享组件
          </a>
        </div>
        <div class="fly-panel leifeng-rank">
          <h3 class="fly-panel-title">
            回答月榜
          </h3>
          <dl>
            <?php foreach ($ans_max as $v) : ?>
              <dd>
              <a href="<?php echo U('home/userCenter/center',array('id'=>$v['uid']));?>">
                <img src="<?php echo '/project/fly/'.$v['face']; ?>">
                <cite>
                 <?php echo $v['nickname']; ?>
                </cite>
                <i>
                  <?php echo $v['answer_num']; ?>次回答
                </i>
              </a>
            </dd>
            <?php endforeach; ?>
          </dl>
        </div>
        <div class="fly-panel">
          <h3 class="fly-panel-title">
            温馨通道
          </h3>
          <ul class="fly-notice">
            <li>
              <a href="http://fly.layui.com/jie/5366/" target="_blank">
                layui 1.x 版本常见问题的处理和实用干货集锦
              </a>
            </li>
            <li>
              <a href="https://fly.layui.com/jie/4281/" target="_blank">
                layui 的 GitHub 及 开源中国码云 仓库地址
              </a>
            </li>
            <li>
              <a href="http://fly.layui.com/jie/8157/" target="_blank">
                下载“Fly社区”页面模板：Fly Template v2.0
              </a>
            </li>
            <li>
              <a href="http://layim.layui.com/?from=fly" target="_blank">
                欢迎提供情怀赞助，促进 layui 系列良性发展
              </a>
            </li>
          </ul>
        </div>
        <div class="fly-panel">
          <a href="http://layim.layui.com/?from=fly" target="_blank">
            <img src="/project/fly/Public/images/168_1500291753257_18702.jpg" style="width: 336px; height: 166px;"
            alt="layim下载">
          </a>
        </div>
        <dl class="fly-panel fly-list-one">
          <dt class="fly-panel-title">
            近期热议
          </dt>
          <?php foreach ($rows as $row):?>
              <dd>
              <a href="<?php echo U('home/discuss/index').'?qid='.$row['qid'] ?>">
                <?php echo $row['title']; ?>
              </a>
              <span>
                <i class="iconfont">
                  &#xe60c;
                </i>
                <?php echo $row['answer_num']; ?>
              </span>
            </dd>
            <?php endforeach; ?>
        </dl>
        <div class="fly-panel fly-link">
          <h3 class="fly-panel-title">
            友情链接
          </h3>
          <dl>
            <dd>
            <a href="http://layim.layui.com/" target="_blank">
              WebIM
            </a>
            <dd>
            
          </dl>
        </div>
      </div>
    </div>

</div>
    <div class="footer">
      <p>
        <a href="http://fly.layui.com/">
          Fly社区
        </a>
        2017 &copy;
        <a href="http://www.layui.com/">
          layui.com
        </a>
      </p>
      <p>
        <a href="http://fly.layui.com/jie/3147.html" target="_blank">
          产品授权
        </a>
        <a href="http://fly.layui.com/jie/8157.html" target="_blank">
          获取Fly社区模版
        </a>
        <a href="http://fly.layui.com/jie/2461.html" target="_blank">
          微信公众号
        </a>
      </p>
    </div>

    
  </body>
	<script type="text/javascript">
		layui.use(['layer', 'form','element'], function(){
		  var layer = layui.layer
		  ,form = layui.form();
		   $ = layui.jquery;
		  /*form.on('submit(login)', function(data){
				$.ajax({
				url:'<?php echo U("home/login/checkdata");?>',
					type: 'POST',
					dataType: 'json',
					data: data.field,
				})
				.done(function(respones) {
					if(respones.error==1){
                        layer.msg(respones.info,function (){

                     })
					}else{
                        layer.alert('登录成功',{icon:6},function (){
                            location.href='<?php echo U("home/user/index");?>';
                        });
                    }
				})
				.fail(function() {
					console.log("error");
				});

				return false;
		   });*/
		 
		
		});
	</script>
</html>